package com.bai.localshop.pojo.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Min;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 商品保存DTO（接收前端保存参数）
 */
@Data
public class ProductSaveDTO {
    private Long id;

    @NotBlank(message = "商品名称不能为空")
    private String name;

    private String description;

    @NotNull(message = "商品价格不能为空")
    @Min(value = 0, message = "商品价格不能小于0")
    private BigDecimal price;

    private String image;

    @NotNull(message = "商品分类不能为空")
    private Long categoryId;

    @NotNull(message = "库存数量不能为空")
    @Min(value = 0, message = "库存数量不能小于0")
    private Integer stock;

    private Integer status = 1;

    private String detail;

    @Min(value = 0, message = "排序权重不能小于0")
    private Integer sort = 0;

    private Boolean isHome = false;
}